﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using Model.RF.ATETest;
using IDAL.RF.ATETest;

namespace DAL.RF.ATETest
{
    public class tb_DFL_Info : BaseRepository<tb_DFL_Info_Info>, Itb_DFL_Info
    {
        #region 静态变量定义
        private const string PARM_TB_RESULTID = "@resultid";
        #endregion

        #region 数据检索部分
        public IList<tb_DFL_Info_Info> tb_DFL_Info_GetbyID(int id)
        {
            SqlParameter parm = GetParameter();
            parm.Value = id;
            return ExcuteSqlToGetEntities("tb_DFL_Info_select", parm);
        }

        public IList<tb_DFL_Info_Info> tb_DFL_Info_GetbyID_withoutFilter(int id)
        {
            SqlParameter parm = GetParameter();
            parm.Value = id;
            return ExcuteSqlToGetEntities("tb_DFL_Info_select_withoutFilter", parm);
        }
        #endregion

        #region 重写基类方法
        public override tb_DFL_Info_Info GetEntityRecord(SqlDataReader rdr)
        {
            tb_DFL_Info_Info entity = new tb_DFL_Info_Info()
            {
                resultid = rdr.GetInt32(0),
                partcode = rdr.GetValue(1).ToString(),
                testtime = rdr.GetDateTime(2),
                Itemcode = rdr.GetValue(3).ToString(),
                ModuleType = rdr.GetValue(4).ToString(),
                Vender = rdr.GetValue(5).ToString(),
                Remark1 = rdr.GetValue(6).ToString(),
                Remark2 = rdr.GetValue(7).ToString(),
                Remark3 = rdr.GetValue(8).ToString()
            };
            return entity;
        }

        public override SqlParameter GetParameter()
        {
            SqlParameter parm = new SqlParameter(PARM_TB_RESULTID, SqlDbType.Int, 4);
            return parm;
        }
        #endregion
    }
}
